//
//  NSUserDefaults+JPF.h
//  JPFCore
//
//  Created by JPFei on 2019/3/21.
//  Copyright © 2019 JPF All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface NSUserDefaults (JPF)

#pragma mark - 公共方法
// 删除NSArray中的NSNull
+ (NSMutableArray *)removeNullFromArray:(NSArray *)arr;
// 删除Dictionary中的NSNull
+ (NSMutableDictionary *)removeNullFromDictionary:(NSDictionary *)dic;

/**
 *  存储数组数据，避免因为包含NSNull类型崩溃
 *
 *  @param arr 待保存的数据
 *  @param key key
 */
+ (void)saveArr:(NSArray *)arr forKey:(NSString *)key;
/**
 *  存储字典数据，避免因为包含NSNull类型崩溃
 *
 *  @param dic 待保存的数据
 *  @param key key
 */
+ (void)saveDic:(NSDictionary *)dic forKey:(NSString *)key;

#pragma mark - 安全存储,避免因存储不了的类型造成bug
+ (void)setCustomObject:(id)obj forKey:(NSString *)key;
+ (id)customObjectForKey:(NSString *)key;

/*!
 @brief 进入app保存状态
 @param  haveEnteredApp 进入与否。。
 */
+ (void)saveHaveEnteredApp:(BOOL)haveEnteredApp;

/*!
 @brief 判断是否进入app
 */
+ (BOOL)haveEnteredApp;

@end

NS_ASSUME_NONNULL_END
